package com.xbongbong.paas.pojo.workflow;

import com.xbongbong.paas.pojo.UserDetailPojo;
import com.xbongbong.paas.pojo.UserSimpPojo;
import com.xbongbong.paas.pojo.UserSimpleForNodePojo;
import com.xbongbong.pro.user.pojo.UserTypePojo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.util.List;

/**
 * @author 吴峰
 * @date 2021/05/19 16:45
 */
@Getter
@ToString
@Setter
public class WorkflowNodeTreePojo implements Serializable {
    private static final long serialVersionUID = -3272685075768111103L;

    private Long workflowId;

    private Long workflowNodeId;

    /**
     * 节点名称
     */
    private String name;
    /**
     * 节点id 前端传
     */
    private String nodeId;
    /**
     * 上级节点id 前端返回的
     */
    private String prevId;

    private String wrapperId;
    /**
     * 节点子类型
     */
    private Integer subType;
    /**
     * 节点类型
     */
    private Integer type;
    /**
     * 条件优先级
     */
    private Integer priority;

    /**
     * 节点块显示的内容
     */
    private Object content;

    /**
     * 头像列表
     */
    private List<String> avatarList;
    /**
     * 子节点
     */
    private WorkflowNodeTreePojo childNode;
    /**
     * 子条件分支
     */
    private List<WorkflowNodeTreePojo> conditionNodes;
    /**
     * 标识历史节点
     * 1: 表示该节点为历史节点
     */
    private Integer isHistory;

    /**
     * 流转条件类型,1使用自定义流转条件，2使用else条件；3：有结果；4：无结果
     * @see com.xbongbong.workflow.enums.WorkflowNodeConditionTypeEnum
     */
    private Integer conditionType;
    /**
     * 分支类型，1: 普通分支/ 2:查找结果分支
     *
     */
    private Integer conditionNodeType;

    private String memo;

    /**
     * 跟当前节点的关系（用于查看全流程建树）：
     *  0：在当前节点之前
     *  1：当前节点
     *  2：在当前节点之后
     */
    private Integer currentFlag;

    /**
     * 当前节点已审批人列表（用于查看全流程建树）
    */
    private List<UserSimpleForNodePojo> haveApproveList;

    /**
     * 当前节点待审批人列表（用于查看全流程建树）
     */
    private List<UserSimpleForNodePojo> untreatedApproveList;

    /**
     * 抄送节点抄送人列表（用于查看全流程建树）
     */
    private List<UserSimpleForNodePojo> ccUserList;

    public WorkflowNodeTreePojo() {
    }

    public WorkflowNodeTreePojo(Long workflowId, Long workflowNodeId, String name, String nodeId, String prevId, String wrapperId, Integer type) {
        this.workflowId = workflowId;
        this.workflowNodeId = workflowNodeId;
        this.name = name;
        this.nodeId = nodeId;
        this.prevId = prevId;
        this.wrapperId = wrapperId;
        this.type = type;
    }

    public static void setProperty(WorkflowNodeTreePojo workflowNodeTreePojo, Long workflowId, Long workflowNodeId, String name, String nodeId, String prevId, String wrapperId, Integer type, Integer priority) {

        workflowNodeTreePojo.setName(name);
        workflowNodeTreePojo.setNodeId(nodeId);
        workflowNodeTreePojo.setWorkflowId(workflowId);
        workflowNodeTreePojo.setWorkflowNodeId(workflowNodeId);
        workflowNodeTreePojo.setPrevId(prevId);
        workflowNodeTreePojo.setWrapperId(wrapperId);
        workflowNodeTreePojo.setType(type);
        workflowNodeTreePojo.setPriority(priority);
    }
}
